/** 认证服务接口 */
import { Injectable } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/delay';

@Injectable()
export class AuthService {
  public isLoggedIn = false;

  // 登录之后跳转的URL
  public redirectUrl: string;

  // 模拟登录和登出
  public login(): Observable<boolean> {
    return Observable.of(true).delay(1000).do(() => this.isLoggedIn = true);
  }
  public logout(): void {
    this.isLoggedIn = false;
  }

}
